import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  // 存放数据信息
  state: {
    token: {},
    user: {}
  },
  mutations: {
    setToken (state, token) {
      state.token = token
      sessionStorage.setItem('token', token)
    },
    removeToken (state, token) {
      state.token = ''
      sessionStorage.removeItem('token')
    }
  }
})
